package com.andy.wang.pojo;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import java.io.Serializable;

/**
 * 聊天房
 * @TableName accroom
 */
@TableName(value ="accroom")
@Data
public class Accroom implements Serializable {
    /**
     * 房间主键
     */
    @TableId(type = IdType.AUTO)
    private Integer roomID;

    /**
     * 当前是哪个房间的信息
     */
    @TableField("rid")
    private Integer rid;

    /**
     * 房间发起人 :  userID
     */
    @TableField("roomInitiator")
    private Integer roomInitiator;

    /**
     * 进入房间人:   userID
     */
    @TableField("enteredRoom")
    private Integer enteredRoom;

    /**
     * 是否要删除【0.不删除  1.删除】
     */
    @TableField("isDeleted")
    @TableLogic
    private Integer isDeleted;

    private Integer userNumber;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Accroom other = (Accroom) that;
        return (this.getRoomID() == null ? other.getRoomID() == null : this.getRoomID().equals(other.getRoomID()))
            && (this.getRid() == null ? other.getRid() == null : this.getRid().equals(other.getRid()))
            && (this.getRoomInitiator() == null ? other.getRoomInitiator() == null : this.getRoomInitiator().equals(other.getRoomInitiator()))
            && (this.getEnteredRoom() == null ? other.getEnteredRoom() == null : this.getEnteredRoom().equals(other.getEnteredRoom()))
            && (this.getIsDeleted() == null ? other.getIsDeleted() == null : this.getIsDeleted().equals(other.getIsDeleted()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getRoomID() == null) ? 0 : getRoomID().hashCode());
        result = prime * result + ((getRid() == null) ? 0 : getRid().hashCode());
        result = prime * result + ((getRoomInitiator() == null) ? 0 : getRoomInitiator().hashCode());
        result = prime * result + ((getEnteredRoom() == null) ? 0 : getEnteredRoom().hashCode());
        result = prime * result + ((getIsDeleted() == null) ? 0 : getIsDeleted().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", roomID=").append(roomID);
        sb.append(", rid=").append(rid);
        sb.append(", roomInitiator=").append(roomInitiator);
        sb.append(", enteredRoom=").append(enteredRoom);
        sb.append(", isDeleted=").append(isDeleted);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
